Skip to content

Conversation

Zubayear
Copy link

This PR improves the Trie implementation:

  • Improve time complexity of Size() - O(1)
  • Remove unnecessary update of isLeaf flag on duplicate node
  • Empty string insertion prevented
  • Lazy remove decrements total count correctly
  • Added edge-case tests:
    • Empty string insertion
    • Substrings and shared prefixes
    • Removing non-existent words
    • Removing words sequentially
  • Added benchmark for Size()

This makes the Trie faster, safer, and properly tested.

Copy link

This PR is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.

@github-actions github-actions bot added the stale label Sep 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant